<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layouts::header"></head>
<body>
<nav th:replace="layouts::navbar"></nav>

<div class="container">
    <div class="logo"></div>
    <hr>
    <h3>商品目录</h3>
    <br>
    <a th:href="@{/commodities/new}" class="btn btn-primary btn-sm mb-3">新增商品</a>
    <br>
    <table class="table table-bordered table-striped">
        <thead class="thead-dark">
        <tr>
            <th>商品ID</th>
            <th>商品名称</th>
            <th>商品类别</th>
            <th>生产日期</th>
            <th>商品数量</th>
            <th>商品单价</th>
            <th>活动</th>

        </tr>
        </thead>
        <tbody>
        <tr th:each="aCommodity : ${kindCommodities}">
            <td th:text="${aCommodity.commodityId}"></td>
            <td th:text="${aCommodity.name}"></td>
            <td th:text="${aCommodity.kind}"></td>
            <td th:text="${aCommodity.date}"></td>
            <td th:text="${aCommodity.number}"></td>
            <td th:text="${aCommodity.price}"></td>
            <td>
                <a th:href="@{/commodities/update(id=${aCommodity.commodityId})}" class="btn btn-info btn-sm">更新</a>
                <a
                        th:href="@{/commodities/delete(id=${aCommodity.commodityId})}"
                        class="btn btn-danger btn-sm"
                        onclick="if(!(confirm('你确定删除这个商品吗'))) return false"
                >删除</a>
            </td>
        </tr>
        </tbody>
    </table>
</div>


</body>
</html>